package com.ruoyi.app.controller;

import com.ruoyi.business.domain.ImUser;
import com.ruoyi.business.service.IImUserService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.domain.$;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.app.interceptor.VersionLocalinterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 即时通讯用户Controller
 *
 * @author ruoyi
 * @date 2025-07-11
 */
@RestController
@RequestMapping(VersionLocalinterceptor.version+"/business/imUser")
public class ImUserControllerApp extends BaseController
{
    @Autowired
    private IImUserService imUserService;

    /**
     * 获取即时通讯用户详细信息
     */
    @GetMapping(value = "/{id}")
    public $ getInfo(@PathVariable("id") Long id)
    {
        return $.success(imUserService.selectImUserById(id));
    }

    /**
     * 新增即时通讯用户
     */
    @Log(title = "即时通讯用户", businessType = BusinessType.INSERT)
    @PostMapping
    public $ add(@RequestBody ImUser imUser)
    {
        return $.success(imUserService.insertImUser(imUser));

    }

    /**
     * 修改即时通讯用户
     */
    @Log(title = "即时通讯用户", businessType = BusinessType.UPDATE)
    @PutMapping
    public $ edit(@RequestBody ImUser imUser)
    {
        return $.success(imUserService.updateImUser(imUser));
    }

    /**
     * 删除即时通讯用户
     */
    @Log(title = "即时通讯用户", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public $ remove(@PathVariable Long[] ids)
    {
        return $.success(imUserService.deleteImUserByIds(ids));
    }
}
